PostgreSQL Setup
Download & Install PostgreSQL
-
Download the PostgreSQL installer for Windows from the official website:
https://www.postgresql.org/download/windows/ -
Run the installer and follow the setup wizard:
- Choose an installation directory.
- Set a password for the postgres superuser — remember this, you will need it.
- Keep the default port 5432.
- Select pgAdmin 4 (recommended) as a management tool during installation.
Start PostgreSQL Service
PostgreSQL runs as a Windows service automatically after installation.
To verify it is running:
- Open Services (
Win + R→ typeservices.msc). - Find postgresql-x64-XX in the list.
- Status should show Running. If not, right-click → Start.
Create Database and User
Using pgAdmin 4
- Open pgAdmin 4 from the Start menu.
- Connect to the local server using the postgres superuser password set during installation.
- Right-click Databases → Create → Database.
- Set Database name to
whoxaand click Save. - Right-click Login/Group Roles → Create → Login/Group Role.
- Set name to
whoxa_user, go to Definition tab → set password, go to Privileges tab → enable Can login. Click Save. - Right-click the
whoxadatabase → Properties → Security → grant all privileges towhoxa_user.
Using SQL Shell (psql)
Open SQL Shell (psql) from the Start menu and run:
CREATE DATABASE whoxa;
CREATE USER whoxa_user WITH PASSWORD 'your_strong_password';
GRANT ALL PRIVILEGES ON DATABASE whoxa TO whoxa_user;
Verify:
\l
Configure Environment Variables
In your backend .env file, set:
DB_HOST=localhost
DB_PORT=5432
DB_NAME=whoxa
DB_USER=whoxa_user
DB_PASSWORD=your_strong_password
Run Migrations
Once the database is created and environment variables are set:
cd whoxa-whatsapp-business-api
npx sequelize-cli db:migrate
npx sequelize-cli db:seed:all
tip
If you see a connection error, make sure the PostgreSQL service is running and the password in .env matches what you set during installation.